<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/templates/common/taglib.jsp"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
       <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>${title }</title>
    <link rel="stylesheet" href="${basePath}/static/bootstrap/css/bootstrap.css"/>
    <link href="${basePath}/static/css/basic.css" rel="stylesheet" type="text/css">
    <link href="${basePath}/static/css/login.css" rel="stylesheet" type="text/css">
    <link href="${basePath}/static/css1/lyh.css" rel="stylesheet" type="text/css">
    <link href="${basePath}/static/css/list.css" rel="stylesheet" type="text/css">
	<link rel="stylesheet" type="text/css" href="${basePath}/static/css1/index.css">
    <script  type="text/javascript" src="${basePath}/static/js/jquery.min.js"></script>
	<script  type="text/javascript" src="${basePath}/static/My97DatePicker/WdatePicker.js"></script>
	<script  type="text/javascript" src="${basePath}/static/page/jqPaginator/jqPaginator.js"></script>
    
</head>
<body class="bj">
<!--头部-->
	<%@include file="/WEB-INF/templates/common/header.jsp"%>
	<!------导航条-->
	<%@include file="/WEB-INF/templates/common/navigation.jsp"%>

<!--内容部分-->
<div class="list_main lay_out" class="clearfix">
    <div class="list_DH">
        <%@include file="/WEB-INF/templates/common/inhospitalDisease.jsp"%>
    </div>
    <div class="list_NR">
  		<div class="loc">
  			 <h3>质量统计</h3>
  		</div>
  		
	<form action="#" method="post" target="_blank"
		name="form1" class="ss">
		<table class="formTable">
				<tr>
					<td class="Label_1" align="left" width="8%">出院日期</td>
					<td width="34%">
						<input type="text" name="cybrSearch.chuyuanrqStart" id="startTime"
							value=""
							onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="Wdate input input_box_date"
							style="width: 140px" />
						-
						<input type="text" name="cybrSearch.chuyuanrqEnd" id="endTime"
							value=""
							onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="Wdate input input_box_date"
							style="width: 140px" />
						
					</td>
					<td class="Label_1" width="8%">出院科室<input type="hidden" id="ksmcInfo"></td>
					<td colspan="4" width="50%">
						<input type="text" id="cyksSelectId"
							value=""
							name="cybrSearch.cyks" class="input input_box" style="width:45%"  />
					</td>
				</tr>
				<tr>
					<td class="Label_1" align="left">疾病诊断</td>
				<td>
					类目: <input type="text" style="width:57%" class="input input_box" name="cybrSearch.jbzd_lei"
					id="jbzdleiId" value=""><br />
					亚目: <input type="text" style="width:57%" class="input input_box" name="cybrSearch.jbzd_ya"
					id="jbzdyaId" value=""><br />
					细目: <input type="text" style="width:57%" class="input input_box" name="cybrSearch.jbzd_xi"
					id="jbzdxiId" value="">

				   </td>
					<td class="Label_1">疾病名称</td>
					<td colspan="4" class="Label_3_1">
						<select id="jibingName_ID" class="input_box" name="jbSelected" style="width:45%">
							<option value="">
								请选择
							</option>
						</select>
						<input type="hidden" value=""
							id="jbSelected"/>
					</td>
				</tr>		
			     <tr>
					<td align="left" class="Label_1">入院病情</td>
					<td>
						<input type="hidden" id="rybqdata" 
							value="">
						<div id="rybqdiv">
						<input type="checkbox" id="boxrybq1" value="1" name="cybrSearch.rybq" class="check_cl">
						<span>1-有</span>
						<input type="checkbox" id="boxrybq2" value="2" name="cybrSearch.rybq" class="check_cl">
						<span>2-临床未确定</span>
						<input type="checkbox" id="boxrybq3" value="3" name="cybrSearch.rybq" class="check_cl">
						<span>3-情况不明</span>
						</br>
						<input type="checkbox" id="boxrybq4" value="4" name="cybrSearch.rybq" class="check_cl">
						<span>4-无</span>
						</div>
					</td>
				<td align="left" class="Label_1">诊断类型</td>
					<td>
						<input type="checkbox" id="zdlx0" name="cybrSearch.zdlx" value="0">主要诊断<input type="checkbox" id="zdlx1" name="cybrSearch.zdlx" value="1">第1位次要诊断<input type="checkbox" id="zdlx2" name="cybrSearch.zdlx" value="2">第2位次要诊断<input type="checkbox" id="zdlx3" name="cybrSearch.zdlx" value="3">其他诊断
						<input type="hidden" id="zdlx" value="">
					</td>
			</tr>
			<tr>

					<td class="Label_1" align="left">手术操作</td>
				<td>
					类目: <input type="text" style="width:57%" class="input input_box"
					name="cybrSearch.sscz_lei" id="ssczleiId" 
					value=""><br />
					亚目: <input type="text" style="width:57%" class="input input_box" name="cybrSearch.sscz_ya"
					id="ssczyaId"
					value=""><br />
					细目: <input type="text" style="width:57%" class="input input_box" name="cybrSearch.sscz_xi"
					id="ssczXiId"
					value="">
				</td>
					<td class="Label_1">手术名称</td>
					<td  colspan="3">
						<select id="ssczName_ID" class="input_box" name="ssSelected" style="width:45%">
							<option value="">
								请选择
							</option>
						</select>
						<input type="hidden" value=""
							id="ssSelected" />
					</td>
					
					
			</tr>
			<tr>
			<td align="left" class="Label_1" >肿瘤编码</td>
					<td colspan="5">
						
						&nbsp;<input type="text" style="width:25%" id="zhongliuSelectId"
							value="" name="cybrSearch.zl"
							class="input input_box" style="width: 125px" />
							
					</td>
			</tr>
				<tr>
					<td align="left" class="Label_1">年龄</td>
					<td colspan="5"><input type="text" id="startYear" name="cybrSearch.startYear" class="input input_box"
					 	value="" style="width: 50px"/> - <input type="text" 
					 		id="endYear" value=""
							name="cybrSearch.endYear" class="input input_box" style="width: 50px"/>岁&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						
						<input type="text" id="startMonth" name="cybrSearch.startMonth" class="input input_box"
					 	value="" style="width: 50px"/> - <input type="text" 
					 		id="endMonth" value=""
							name="cybrSearch.endMonth" class="input input_box" style="width: 50px"/>月	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							
						<input type="text" id="startDay" name="cybrSearch.startDay" class="input input_box"
					 	value="" style="width: 50px"/> - <input type="text" 
					 		id="endDay" value=""
							name="cybrSearch.endDay" class="input input_box" style="width: 50px"/>天
						
					</td>
				</tr>
				<tr>
					<td align="left" class="Label_1">离院方式</td>
					<td colspan="5">
						<input type="hidden" id="lyfsdata" 
							value="">
						
						<div id="lyfsdiv">
						<input type="checkbox" id="checkbox2" value="2" name="cybrSearch.lyfs" class="check_cl">
						<span>1-医嘱离院</span>
						<input type="checkbox" id="checkbox1" value="1" name="cybrSearch.lyfs" class="check_cl">
						<span>2-医嘱转院</span>
						<input type="checkbox" id="checkbox3" value="3" name="cybrSearch.lyfs" class="check_cl">
						<span>3-医嘱转社区卫生服务机构/乡镇卫</span>
						<input type="checkbox" id="checkbox4" value="4" name="cybrSearch.lyfs" class="check_cl">
						<span>4-非医嘱离院</span>
						<input type="checkbox" id="checkbox5" value="5" name="cybrSearch.lyfs" class="check_cl">
						<span>5-死亡</span>
						<input type="checkbox" id="checkbox9" value="9" name="cybrSearch.lyfs" class="check_cl">
						<span>9-其他</span>
						<span class="Label_5">
						<a>全选</a>
						<a>撤消</a>
						</span>
						</div>
						
					</td>
				</tr>

				<tr>
				<td class="Label_5" colspan="6">	
					<!-- <input class="int" type="button" value="统计" onclick="tj()"/> -->
					<a onclick="tj()" id="ssczxiId">统计</a>
					<a onclick="clearSession()">清空</a>
					<!-- <input class="int" type="button" value="清空" onclick="clearSession()"/>	 -->		
				</td>
				</tr>
		</table>
	</form>
</div>
</div>
<!------页脚部分--------->
<%@include file="/WEB-INF/templates/common/footer.jsp"%>

 <!--JS部分-->
<script type="text/javascript">
		$(window).load(function(){
//要执行的方法体
});
		
function tj(){
	window.location.href="${basePath}/statics/statisticIndex"
}
		
$(function(){
	$("input[type='checkbox']").addClass("check_cl");
	hideDiv();
	function hideDiv(){
		$("#ysDiv").hide();
		$("#zyDiv").hide();
		$("#ksDiv").hide();
		$("#jbDiv").hide();
		$("#zlDiv").hide();
		$("#sfzdis").hide();
	}
				// /////////////手术操作////////////////////
	$("#ssmcID").click(function() {
		$("#mainContent").attr("src", "bingan/basy/selectSSCZ.jsp");
		hideDiv();
		$("#sfzdis").show();
		return false;
	});
	// /////////////疾病////////////////////
	$("#jbzdSelectId").click(function() {
		$("#mainContentJB").attr("src", "bingan/basy/selectJBZD.jsp");
		hideDiv();
		$("#jbDiv").show();
		return false;
	});
	// /////////////肿瘤////////////////////
	$("#zhongliuSelectId").click(function() {
		$("#mainContentZL").attr("src", "bingan/basy/selectZL.jsp");
		hideDiv();
		$("#zlDiv").show();
		return false;
	});

	
	$("#zrrname").click(function(){
		$("#mainContentYS").attr("src", "bingan/basy/selectZLYS.jsp");
		hideDiv();
		$("#ysDiv").show();
		return false;
	});
	$("#zhaiyao").click(function(){
		var arr=$("#zhaiyao").val().split(",");
		var i = 1;
		for(var index in arr){
			var jq_zy =  arr[index];
			var str = "#zyt" + i;
			$(str).val(jq_zy);
			i++;
		}
		hideDiv();
		$("#zyDiv").show();
		$("#zyt1").focus();
	});
	$("#zyset").click(function(){
		$("#zyDiv").hide();
	});
	$("#zysub").click(function(){
		var result = $("input[id^=zyt]");
		var str = "";
		var i = 1;
		result.each(function(){
			var jq_zyt=$(this);
			if(jq_zyt.val() != null && jq_zyt.val() != ""){
				str+=jq_zyt.val()+",";
				var jq_val = "#zyt" + i;
				$(jq_val).val(jq_zyt.val());
			}
			i++;
		});
		$("#zhaiyao").val(str);
		$("#zyDiv").hide();
	});
	
	$("#cyksSelectId").click(function() {
		$("#mainContentKS").attr("src", "bingan/basy/selectCYKS.jsp");
		hideDiv();
		$("#ksDiv").show();
		return false;
	});
	$("a[id^=basyy]").click(function() {
		var bsm = $(this).attr("bsm");
		$.post("bingan/getbaseInfoForFrame", 
			{selectParam : bsm, mark : '2'},
			function(data) {
				if (typeof (data) == "string") {
					alert(data);
					return false;
				}
				//调用父类的元素
				var jq_fuALink = $(parent.document).find("input[id='basy']");
				jq_fuALink.trigger("click");
		}, 'json');
		return false;
	});
	$.post('http://localhost:8080/CMDP/bingan/select_bzflForJson', {}, function(data) {
			var jq_jbSelect = $("#jibingName_ID");
			var jq_ssSelect = $("#ssczName_ID");
			var jbSelected = $("#jbSelected").val();
			var ssSelected = $("#ssSelected").val();
			for ( var index in data) {
				var dbData = data[index];
				var type = dbData.bztype;
				var name = dbData.name;
				var leimu = dbData.leimu;
				var yamu = dbData.yamu;
				var ximu = dbData.ximu;
				var responseVal = "";
				if (leimu) {
					responseVal+=leimu+";";
				}else{
					responseVal+=";";
				}
				if (yamu) {
					responseVal+=yamu+";";
				}else{
					responseVal+=";";
				}
				if (ximu) {
					responseVal+=ximu+";";
				}else{
					responseVal+=";";
				}
				if(responseVal == jbSelected || responseVal == ssSelected){
					var opt = $("<option>").val(responseVal).text(name).attr("selected",true);
				}else{
					var opt = $("<option>").val(responseVal).text(name);
				}
				if (1 == type) {
					jq_jbSelect.append(opt);
					
				} else if (2 == type) {
					jq_ssSelect.append(opt);
				}
			}
		}, "json");
	$.post('http://localhost:8080/CMDP/lkjqiantai/getNeedInfoForGD.action', null,
					function(data) {
						var lyfsData = data['lyfs'];
						var jq_lyfs = $("#lyfsdiv");
						for ( var index in lyfsData) {
							var Obj = lyfsData[index];
							var code = Obj.code;
							var name = Obj.name;
							var createSpan = $("<span>").text(name);
							var inputCheckBox = $("<input>").attr( {
								type : "checkbox",
								id : "checkbox" + code,
								value : code,
								name : "cybrSearch.lyfs",
								class : "check_cl"
							}).after(createSpan);
							jq_lyfs.append(inputCheckBox);
						}
						var qxbtn = $("<input>").attr( {
							type : "button",
							value : "全选",
							class : "int leaveStyle"
						}).click(function() {
						
						var lyfs=getFormVals("cybrSearch.lyfs");
						var data = lyfs.split(",");
						for(var i=0;i<data.length;i++){
							var eleId = "checkbox" +data[i];
							$("#" + eleId).attr("checked", 'true');
						}
						/* if(this.value=="全选"){
							var data = lyfs.split(",");
							for(var i=0;i<data.length;i++){
								var eleId = "checkbox" +data[i];
								$("#" + eleId).attr("checked", 'true');
							}
							this.value="取消全选";
						}else{
							var data = lyfs.split(",");
							for(var i=0;i<data.length;i++){
								var eleId = "checkbox" +data[i];
								$("#" + eleId).attr("checked", false);
							}
							this.value="全选";
						} */
							/* if(this.value =="全选"){
								$("input[id^=checkbox]").attr("checked", 'true');
								this.value ="全不选";
							}else{
								$("input[id^=checkbox]").attr("checked", 'false');
								this.value ="全选";
							} */
							
						});
						
						
						var qbxbtn = $("<input>").attr( {
							type : "button",
							value : "撤消",
							class : "int leaveStyle"
						}).click(function() {
						
						var lyfs=getFormVals("cybrSearch.lyfs");
						var data = lyfs.split(",");
						for(var i=0;i<data.length;i++){
							var eleId = "checkbox" +data[i];
							$("#" + eleId).attr("checked", false);
						}
						/* if(this.value=="全选"){
							var data = lyfs.split(",");
							for(var i=0;i<data.length;i++){
								var eleId = "checkbox" +data[i];
								$("#" + eleId).attr("checked", 'true');
							}
							this.value="取消全选";
						}else{
							var data = lyfs.split(",");
							for(var i=0;i<data.length;i++){
								var eleId = "checkbox" +data[i];
								$("#" + eleId).attr("checked", false);
							}
							this.value="全选";
						} */
							/* if(this.value =="全选"){
								$("input[id^=checkbox]").attr("checked", 'true');
								this.value ="全不选";
							}else{
								$("input[id^=checkbox]").attr("checked", 'false');
								this.value ="全选";
							} */
							
						});
						
						jq_lyfs.append(qxbtn).append(qbxbtn);
						var lyfsdata = $("#lyfsdata").val();
						if (lyfsdata) {
							var data = lyfsdata.split(",");
							for ( var index in data) {
								var exsistid = $.trim(data[index]);//IE,火狐都支持
					var eleId = "checkbox" + exsistid;
					$("#" + eleId).attr("checked", 'true');
				}
			}
			
			//获取checkbox框的值
 		function getFormVals(name){
		 var arr = [];
		  $("input[type='checkbox'][name='"+name+"']").each(function(){
		  	arr.push($(this).val());	
		  });
		  return arr.toString();
		}
			var jq_cyksid1 = $("#cyksid1");
			var ks1Data = data['ks'];
			for ( var index in ks1Data) {
				var Obj = ks1Data[index];
				var code = Obj.code;
				var name = Obj.name;
				var opt = $("<option>").val(code).text(name);
				jq_cyksid1.append(opt);
			}

		}, 'json');
		$.post('http://localhost:8080/CMDP/lkjqiantai/getRybqDict.action', null,
					function(data) {
						var rybqData = data['rybq'];
						var jq_rybq = $("#rybqdiv");
						for ( var index in rybqData) {
							var Obj = rybqData[index];
							var code = Obj.code;
							var name = Obj.name;
							var createSpan = $("<span>").text(name);
							var inputCheckBox = $("<input>").attr( {
								type : "checkbox",
								id : "boxrybq" + code,
								value : code,
								name : "cybrSearch.rybq",
								class : "check_cl"
							}).after(createSpan);
							jq_rybq.append(inputCheckBox);
						}
						/**
						var qxbtn = $("<input>").attr( {
							type : "button",
							value : "全选"
						}).click(function() {
							$("input[id^=boxrybq]").attr("checked", 'true');
						});
						jq_rybq.append(qxbtn);**/
						var rybqdata = $("#rybqdata").val();
						if (rybqdata) {
							var data = rybqdata.split(",");
							for ( var index in data) {
								var exsistid = $.trim(data[index]);//IE,火狐都支持
								var eleId = "boxrybq" + exsistid;
								$("#" + eleId).attr("checked", 'true');
							}
						}
		}, 'json');
		var zdlxdata = $("#zdlx").val();
		if (zdlxdata) {
			var data = zdlxdata.split(",");
			for ( var index in data) {
				var exsistid = $.trim(data[index]);//IE,火狐都支持
			var eleId = "zdlx" + exsistid;
			$("#" + eleId).attr("checked", 'true');
			}
		}
		
		$("#jibingName_ID").change(function(){
			if($("#jibingName_ID").val() != ""){
				$("#jbzdleiId").attr("disabled",true); 
				$("#jbzdyaId").attr("disabled",true);
				$("#jbzdxiId").attr("disabled",true);
			}else{
				$("#jbzdleiId").attr("disabled",false); 
				$("#jbzdyaId").attr("disabled",false);
				$("#jbzdxiId").attr("disabled",false);
			}
		});   
	     
		$("#ssczName_ID").change(function(){
			if($("#ssczName_ID").val() != ""){
				$("#ssczleiId").attr("disabled",true); 
				$("#ssczyaId").attr("disabled",true);
				$("#ssczXiId").attr("disabled",true);
			}else{
				$("#ssczleiId").attr("disabled",false); 
				$("#ssczyaId").attr("disabled",false);
				$("#ssczXiId").attr("disabled",false);
			}
		});
	});
	/* function tj() {
		var sbtEle=document.getElementById("tjimg");
		var a = document.getElementById("startTime").value;
		var b = document.getElementById("endTime").value;
		var startY = $("#startYear").val();
		var startM = $("#startMonth").val();
		var startD = $("#startDay").val();
		var endY = $("#endYear").val();
		var endM = $("#endMonth").val();
		var endD = $("#endDay").val();
		if(startY != "" && (startY < 1 ||startY > 200)){
			alert("年龄范围(年)请输入1~200之间的数字");
		}else if(endY != "" && (endY < 1 || endY > 200)){
			alert("年龄范围(年)请输入1~200之间的数字");
		}else if(startM != "" && (startM < 1 || startM > 12)){
			alert("年龄范围(月)请输入1~12之间的数字");
		}else if(endM != "" && (endM < 1 || endM > 12)){
			alert("年龄范围(月)请输入1~12之间的数字");
		}else if (startD != "" && (startD < 1 || startD > 31)){
			alert("年龄范围(日)请输入1~31之间的数字");
		}else if(endD != "" && (endD < 1 || endD > 31)){
			alert("年龄范围(日)请输入1~31之间的数字");
		}else{
			if (a == "" && b == "") {
				alert("请选择开始或结束时间！");
			}else {
			
				if(a == "" && b != ""){
					$("#startTime").val(b);
				}
				if(a != "" && b == ""){
					$("#endTime").val(a);
				}
				document.form1.action = "excel/getAllTJINFO.action";
				document.form1.submit();
			}
		}
	} */

	function clearSession(){
		if(confirm("确定清空查询结果吗？")){
			document.form1.action="excel/clearCountSession.action";
			document.form1.target="_self";
			document.form1.submit();
		}
	}
</script>


</body>
</html>